﻿using System;
using System.Collections.ObjectModel;
using HandsonSoft.Web.WebFormsModelBinder;

namespace SampleWeb
{
    [RaiseBindingError]
    public class Employee
    {
        [TypeConvert]
        [ValueSource(FromProperty.Value)]
        public int EmployeeId { get; set; }

        public string FirstName { get; set; }

        public string LastName { get; set; }

        [ValueSource(FromProperty.SelectedValue)]
        public string EmployeeType { get; set; }

        [ValueSource(FromProperty.SelectedValue)]
        public string Gender { get; set; }
        
        [TypeConvert]
        public DateTime? DateOfBirth { get; set; }

        [TypeConvert]
        public int NoOfDependants { get; set; }
        
        [ValueSource(FromProperty.Checked)]
        public bool IsActive { get; set; }

        [ValueSource(FromProperty.Value)]
        [TypeConvert]
        public Collection<int> Skills { get; set; }

        [ValueSource(FromProperty.Value)]
        [TypeConvert]
        public Collection<int> Hobbies { get; set; }

        [Include]
        public Address Address { get; set; }
    }
}
